<?php


/**
 * Notes:
 * PROJECT_NAME : ERP v1.8 重构erp
 * User: 夏鱼儿<397072174@qq.com>
 * Date: 2024/3/26
 * Time: 15:18
 */

namespace app\admin\validate;


class AdminValidate extends BaseValidate
{
    public function __construct()
    {
        $rule = [
            'mobile'    => 'require|mobile',
            'password'  => 'require|length:6,10',
            'real_name' => 'require',
            "user_name" => "require|unique:admin_user|length:6,20",
        ];

        $message = [
            'mobile.require'    => '手机号不能为空',
            'mobile.mobile'     => '手机号格式不正确',
            'password.require'  => '密码不能为空',
            'password.length'   => '密码长度为6-10位',
            'real_name.require' => '真实姓名不能为空',
            "user_name.require" => '用户名不能为空',
            "user_name.unique"  => '用户名已存在',
            "user_name.length"  => '用户名长度为6-20位',
        ];

        $scene = [
            'add' => ['mobile', 'password', 'user_name']
        ];
        parent::__construct($rule, $message,$scene);
    }
}